/*
 * @Descripttion: 后台管理系统
 * @version: 1.0
 * @Author: 狸猫
 * @Date: 2023-11-17 13:48:51
 * @LastEditors: 赛罗
 * @LastEditTime: 2024-03-26 18:15:21
 */
import request from "@/utils/request";

// 登录方法
export function login(phonenumber, password, code, uuid, platform, tenantId) {
  const data = {
    phonenumber,
    password,
    code,
    uuid,
    platform,
    tenantId,
  };
  return request({
    url: "/enterprise/login",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}

// 注册方法
export function register(data) {
  return request({
    url: "/register",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: "/enterprise/getInfo",
    method: "get",
  });
}

// 退出方法
export function logout() {
  return request({
    url: "/logout",
    method: "post",
  });
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/captchaImage",
    headers: {
      isToken: false,
    },
    method: "get",
    timeout: 20000,
  });
}

// 查询机构集合
export function selectUserDep(phonenumber, password, uuid, code) {
  const data = {
    phonenumber,
    password,
    uuid,
    code,
  };
  return request({
    url: "/enterprise/user/userBusiness/selectUserDep",
    // headers: {
    //   isToken: false,
    // },
    method: "post",
    data: data,
  });
}

export function checkUserState(){
  return request({
    url:'/enterprise/user/userBusiness/checkUserState',
    method:"get",
  })
}

//切换企业
export function switchEnterprise(data) {
  return request({
    url: "/enterprise/user/userBusiness/switchingEnterprise",
    method: "put",
    data: data,
  });
}
